<!--************************************************************************************************-->
<!-- < mainPage.php >                                                                               -->
<!-- Copyright (c) 2012-2013 San Yat-sun University School of Software                              -->
<!-- Founder & Modifier: Tianjaio Li                                                                -->
<!-- Stu : 10389159                                                                                 -->
<!-- Date: 2012-12-23                                                                               -->
<!-- Destription : 增加getUsernameById                                                             -->
<!--                                                                                                -->
<!-- Version : 2.1 
	lastUpdate: 2013-1-2 16:46 By Tianjiao Li                                                                                 -->
<!--************************************************************************************************-->


<?php 
	include_once("../db/Label.php");
	
	class LabelManager
	{
		static $instance;
		private $label;
		
		public function __construct()
		{
		}
		
		public static function getInstance()
		{
			if (self::$instance == null)
				self::$instance = new self();
			return self::$instance;
		}
		
		public function insert($array)
		{
			$label = new Label($array);
			$label->insert();
			return true;
		}
		
		public function delete($array)
		{
			$label = new Label($array);
			$label->delete();
		}
		
		public function update($array)
		{
			$label = new Label($array);
			$label->update();
		}
		
		public function exist($content)
		{
			$result = $this->getValueByContent($content);
			if($result == null)
				return false;
			return true;
		}
		
		public function getValueById($id)
		{
			$label = new Label(null);
			return $label->findValueById($id);
		}
		
		public function getValueByContent($content)
		{
			$label = new Label(null);
			return $label->findValueByContent($content);
		}
		
		public function getIDByContent($content)
		{
			$result = $this->getValueByContent($content);
			return $result['ID'];
		}
	}
?>